import axios from '@/plugins/axios';
const BASE_API = import.meta.env.VITE_APP_BASE_APIURL as string;

import { CommontTypes, ReservationTypes, ResponseVo } from '@/type';

export namespace ReservationService {
  export const pageReservation = async (data:Partial<ReservationTypes.IReservationItem> & CommontTypes.IPaginationParam): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/reservation/page',{params:data, baseURL: BASE_API});
    return res;
  };

  export const addReservation = async (data:ReservationTypes.IReservationItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/reservation/add',data,{baseURL: BASE_API});
    return res;
  };

  export const editReservation = async (data:ReservationTypes.IReservationItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/reservation/edit',data,{baseURL: BASE_API});
    return res;
  };

  export const detailReservation = async (id:number): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/reservation/detail',{params:{id}, baseURL: BASE_API});
    return res;
  };
}
